package com_djm_2025_06_04;

/**
 * 演示this的测试类
 *
 * @author dengjiangming
 * @date 2025-06-04
 * @version 1.0.0
 */
public class ThisDemo {

    public String name;

    public int year;

    public ThisDemo() {

    }

    public void method() {
        int year = 2;
        System.out.println(year);
        this.year = 10;
        System.out.println(this.year);
    }

    public ThisDemo(String name, int year) {
        //调用无参的构造方法
        this();
        this.name = name;
        this.year = year;
    }

    public static void main(String[] args) {
        ThisDemo thisDemo = new ThisDemo("dengjiangming",2025);
        thisDemo.method();
    }
}
